import { Component, OnInit, Input } from '@angular/core';
import { Router } from '@angular/router';
import { AppGlobalService } from '../../shared/service/app-global.service';

@Component({
  selector: 'app-show-list',
  templateUrl: './show-list.component.html',
  styleUrls: ['./show-list.component.scss']
})
export class ShowListComponent implements OnInit {

  // 组件数据
  @Input() tagData: any = {};

  constructor(private router: Router, private appGlobalService: AppGlobalService) { }

  ngOnInit() {
  }


  /**
   * 查看全部列表
   *
   * @memberof ShowListComponent
   */
  showAllList() {
    const all = this.tagData['all'];
    const params = {
      pageId: all['target'],
      params: {},
      sessionId: localStorage.getItem('sessionId')
    };
    this.appGlobalService.goToForward(params);
  }


  /**
   * 列表项跳转详情
   *
   * @memberof ShowListComponent
   */
  showDetail(id) {
    const clickRow = this.tagData['clickRow'];
    const params = {
      pageId: clickRow['target'],
      params: { id: id },
      sessionId: localStorage.getItem('sessionId')
    };
    this.appGlobalService.goToForward(params);
  }

}
